USE [texchange_db]
GO

/****** Object:  UserDefinedFunction [dbo].[Fn_GetAllLanguages]    Script Date: 05/29/2011 19:54:25 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
CREATE FUNCTION [dbo].[Fn_GetAllLanguages] 
(	
	-- Add the parameters for the function here
	@start  bigint=0,
	@limit bigint=30,
	@order nvarchar(10) = 'id',
	@orderdir nvarchar(4) = 'desc'
)
RETURNS TABLE 
AS
RETURN 
(
	-- Add the SELECT statement with parameter references here
	SELECT [id], [language_name], [isActive],[short] from
			(SELECT *, ROW_NUMBER() OVER (ORDER BY id asc) AS  rownum FROM Languages) as a
		WHERE rownum >=@start AND rownum<=@limit
)

GO


